<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>简历首页</title>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.16.custom.css" />
<link rel="stylesheet" type="text/css" href="css/validator.css" />
<link rel="stylesheet" href="css/howitworks.css" />
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/pixie.css" />

<style type="text/css" title="currentStyle">
@import "css/demo_page.css";
@import "css/demo_table.css";
@import "css/jquery-ui-1.8.16.custom.css";
</style>

<script type="text/javascript" language="javascript" src="js/jquery-1.6.4.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>

<script type="text/javascript" language="javascript" src="js/jquery.bgiframe-2.1.2.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.widget.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.mouse.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.button.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.draggable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.position.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.resizable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.dialog.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.effects.core.js"></script>
	
<style>
	body { font-size: 62.5%; }
	input.text { margin-bottom:12px; width:95%; padding: .4em; }
	fieldset { padding:0; border:0; margin-top:25px; }
	h1 { font-size: 1.2em; margin: .6em 0; }
	div#users-contain { width: 350px; margin: 20px 0; }
	div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
	div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
	.ui-dialog .ui-state-error { padding: .3em; }
	.validateTips { border: 1px solid transparent; padding: 0.3em; }
</style>
	
<% 
String permLevel = session.getAttribute( "perm-level") == null ? "0" : session.getAttribute( "perm-level").toString(); 
%>

<script type="text/javascript" charset="utf-8">

window.onbeforeunload = function()
{
	if(Math.abs(event.clientX - document.body.clientWidth) < 30)
	{
		if (confirm('确实要退出简历管理？'))
			window.location.href("login.action");
		else
			event.returnValue = '请点取消留在本页面！';
	}
}


function init() {
    document.body.oncontextmenu=function(){return false;}
}

function click()   {                                                                                                                             
	if(event.ctrlKey && event.keyCode == 67)   {                                                                                                                     
		return false;                                                          
	}                                                                                                                                                               
}                                                                                                                                                               
document.onkeydown=click;

$(document).ready(function() {
	init();
	
	var page = document.getElementById("page").value;
	var pageSize = document.getElementById("pageSize").value;
	var totalCount = document.getElementById("totalCount").value;
	
	permControl();
	
    $('#searchRes').dataTable( {
    	"bAutoWidth": true,
    	"bJQueryUI": false,
    	"iDisplayLength": pageSize,
    	"aLengthMenu": [10, 25, 50],
    	"bSort": false,
    	"bFilter": false,
		"iDeferLoading": totalCount,
		"bServerSide": true,
    	"bLengthChange": true, //用户不可改变每页显示数量
    	"iDisplayStart":page * pageSize,
        "sPaginationType": "full_numbers",
        	"aoColumns": [
			{ "bVisible": false, "asSorting": [ "desc" ] },
			null,
			null,
			null,
			null,
			null,
			null,
			null
			]
    });
    
    $('#searchRes_previous').bind( 'click.DT', function() {
    	retrieveData("0");
	} );
    
    $('#searchRes_next').bind( 'click.DT', function() {
    	retrieveData("1");
	} );
    
    $('#searchRes_first').bind( 'click.DT', function() {
    	retrieveData("2");
	} );
    
    $('#searchRes_last').bind( 'click.DT', function() {
    	retrieveData("3");
	} );
    
    $('select', '#searchRes_length').bind('change.DT', function() {
    	document.getElementById("pageSize").value = $(this).val();
    	retrieveData("2");
    });
    
    //var an = oSettings.aanFeatures.p;
    //var qjPaginateList = $('span:eq(2)', "full_numbers");
    //$('span', qjPaginateList).bind( 'click.DT', function(e) {
    //	retrieveIntData($('#searchRes_paginate').innerHTML);
	//} );
} );

	function retrieveIntData(param) {
		alert(param);
	}

	function retrieveData(param) {
		var page = document.getElementById("page").value;
		var totalCount = document.getElementById("totalCount").value;
		var pageSize = document.getElementById("pageSize").value;
		var nextPage = 0;
		
		if (param == 2) {
			nextPage = 0;
		} else if(param == 3) {
			nextPage = parseInt(totalCount / pageSize);
		} else 	if (param == 0) {
			nextPage = page - 1;
			if (nextPage < 0) {
				nextPage = 0;
			}
		} else {
			nextPage = 1*page + 1;
			if (totalCount / pageSize < nextPage) {
				nextPage = nextPage - 1;
			}
		}
		
		location.href="resume-main.action?page="+nextPage+"&pageSize=" + pageSize;
	}

	function openNew() {
		window.open('page.html', 'newwindow', 'fullscreen')
	}
</script>

<script>
	function permControl() {
		var permLevel = <%=permLevel%>;
		if (permLevel % 10 < 1) {
			$( "#createResume" ).hide();
		}
		if ((permLevel % 10000) / 1000 < 1) {
			$( "#managerResume" ).hide();
		}
		if ((permLevel % 100000) / 10000 < 1) {
			$( "#userList" ).hide();
		}
		if ((permLevel % 1000000) / 100000 < 1) {
			$( "#createUser" ).hide();
		}
		if ((permLevel % 10000000) / 1000000 < 1) {
			$( "#userList" ).hide();
		}
		
		if ((permLevel % 10000000000) / 1000000000 < 1) {
			$( "#sysManager" ).hide();
		}
	}
	
	function writeXls() {
		$("#isWriteXlsMode").val(1);
		document.getElementById("resume-filter").submit();
	}
</script>
</head>
<body  id="dt_example">
<div class="top_bar">
	<ul class="nav">
		<li><span class="SayHi">欢迎: 
			<%=session.getAttribute("username")%>
		</span>
		</li>
		<li id="search">
			<a href="/resume/resume-list.action">搜索简历</a>
		</li>
		<li id="createResume">
			<a href="/resume/resume-insert.action">新建简历</a>
		</li>
		<li id="managerResume">
			<a href="/resume/resume-manager.action">简历管理</a>
		</li>
		<li id="userList">
			<a href="/resume/user-list.action">用户列表</a>
		</li>
		<li id="createUser">
			<a href="/resume/user-create.action">新建用户</a>
		</li>
		<li id="userList">
			<a href="/resume/audit-list.action?page=0&pageSize=20">日志</a>
		</li>
		<li id="sysManager">
			<a href="/resume/system-manager.action">系统管理</a>
		</li>
		<li>
			<a href="/resume/login.action">退出</a>
		</li>
	</ul>
</div>
<br />
<br />
	<div id="container" class="l_r_center">
		<!-- <s:form action="resume-list" method="post"> -->
				<table cellpadding="0" cellspacing="0" border="0" class="display"
					id="searchRes">
					<thead>
						<tr>
							<th>ID</th>
							<th>姓名</th>
							<th>公司名称</th>
							<th>职位名称</th>
							<th>性别</th>
							<th>年龄</th>
							<th>目前工作地点</th>
							<th>所属行业</th>
						</tr>
					</thead>
					<tbody>
						<s:iterator value="resumeList" id="content" status="st">
							<tr>
								<td><s:property value='#st.index' /></td>
								<td>
									<s:url id="url_user" value="/resume-review.action">
										<s:param name="resumeId" value="%{#content.id}"></s:param>
										<s:param name="type" value="1"></s:param>
									</s:url> 
									<s:a href="%{url_user}" target="_blank">
										<s:property value="%{#content.name}" />
									</s:a>
								</td>
								<td><s:property value="%{#content.corporation}" /></td>
								<td><s:property value="%{#content.position}" /></td>
								<td><s:property value="%{#content.sex}" /></td>
								<td><s:property value="%{#content.dateOfBirth}" /></td>
								<td><s:property value="%{#content.workingPlace}" /></td>
								<td><s:property value="%{#content.industry}" /></td>
							</tr>
						</s:iterator>
					</tbody>
					<tfoot>
						<tr>
							<th>ID</th>
							<th>姓名</th>
							<th>公司名称</th>
							<th>职位名称</th>
							<th>性别</th>
							<th>年龄</th>
							<th>目前工作地点</th>
							<th>所属行业</th>
						</tr>
					</tfoot>
				</table>
				
				<s:hidden id="page" name="page" />
				<s:hidden id="pageSize" name="pageSize"/>
				<s:hidden id="totalCount" name="totalCount"/>
		<!-- </s:form> -->
	</div>
</body>
</html>